#ifndef __MESSAGEHANDLE_H__
#define __MESSAGEHANDLE_H__
#include"stdShared.h"
#include <unordered_map>  //map unorder_map
#include<functional>
#include"function.h"
#include"stdTcpServer.h"
//函数注册表(函数状态基)(函数映射表)
class MessageHandle
{
public:
    using HandleFunction = std::function<void(const Msg &)>;
    // 构造函数
    MessageHandle(const stdTcpSocketPtr& clientInfo);
    //析构函数
    ~MessageHandle();
public:
    //处理信息
    void handleMessage(const Msg &msg);

private:
    stdTcpSocketPtr  m_clientInfo;
    Function m_function;
    // 映射
    std::unordered_map<int, HandleFunction> m_handle;
};

#endif